// index.js
Page({
    data:{
        // 页面初始化信息
        banner:[],
        daohang:[
            {name:"每日推荐",img:"http://p1.music.126.net/4DpSgAVpJny4Ewf-Xw_WQQ==/109951163986641971.jpg"},
            {name:"私人FM",img:"http://p1.music.126.net/Shi7cRT1bDhwpVDM7AOFXg==/109951165265330616.jpg"},
            {name:"歌单",img:"http://p1.music.126.net/uG5p6CnwAHrLqOkaSeRlnA==/109951163986649164.jpg"},
            {name:"排行榜",img:"http://p1.music.126.net/SDFC6A3X2wzUCavYyeGIOg==/109951163986649670.jpg"},
            {name:"直播",img:"http://p1.music.126.net/2JvVZZjcjyCE72fGMsC1hg==/109951166989043011.jpg"},
        ],
        result:[],
        result2:[],
        result3:[],
    },
    onLoad(){
        var that = this;
        // 监听页面加载
        // 请求会失败  在详情里有一个不校验合法域名勾上
        wx.request({
          url: 'https://www.shijiayi.top:4000/banner?type=2',
          method:'GET',
          success:function(res){
              that.setData({
                banner:res.data.banners
              })
          }
        });
        wx.request({
          url: 'https://www.shijiayi.top:4000/personalized',
          method:'GET',
          success:function(res){
              that.setData({
                result:res.data.result.slice(0,3)
              })
          }
        });
        wx.request({
          url: 'https://www.shijiayi.top:4000/personalized/newsong',
          method:'GET',
          success:function(res){
              that.setData({
                result2:res.data.result.slice(0,3)
              })
          }
        })
        wx.request({
          url: 'https://www.shijiayi.top:4000/personalized/djprogram',
          method:'GET',
          success:function(res){
              console.log(res)
              that.setData({
                result3:res.data.result.slice(0,3)
              })
          }
        })
    }
})
